package cn.whx.hrm.constant;

public enum  GradeLevel {
    BRONZE(1L,"青铜"),SILVER(2L,"白银"),GOLD(3L,"黄金"),PLATINUM(4L,"铂金");
    private  Long id;
    private String gradeName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getGradeName() {
        return gradeName;
    }

    public void setGradeName(String gradeName) {
        this.gradeName = gradeName;
    }
    GradeLevel(Long id,String gradeName){
        this.id = id;
        this.gradeName = gradeName;
    }
    public static GradeLevel byId(long id){
        //获取枚举值
        GradeLevel[] values = GradeLevel.values();
        //遍历枚举里面的所有值
        for (GradeLevel gradeLevel:values) {
            //和外面传过来的id进行对比
            if (gradeLevel.getId()==id){
                return gradeLevel;
            }
        }
                return  null;
    }
}
